package com.google.code.jcrawler.curl;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
import org.apache.commons.httpclient.methods.GetMethod;

public class CurlRequest {
	public static String get(String url) {
		HttpClient client = new HttpClient(new MultiThreadedHttpConnectionManager());
		try {
			GetMethod get = new GetMethod(url);
			get.setFollowRedirects(false);
			int iGetResultCode = client.executeMethod(get);
			if (iGetResultCode == 200) {
				return get.getResponseBodyAsString();
			} else {
				return null;
			}
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}

	}
}
